#-- coding=UTF-8
from stdtype import *
import collections

class StartRountineCMD:
    REQ_TEACH_STEER_START              = 0x20
    REQ_TEACH_STEERL                   = 0x21
    REQ_TEACH_STEERR                   = 0x22
    REQ_TEACH_STEER_NEUTRAL            = 0x23
    
    REQ_TEACH_ACCELERATOR1_START       = 0x24
    REQ_TEACH_ACCELERATOR1_MIN         = 0x25     
    REQ_TEACH_ACCELERATOR1_MAX         = 0x26 
    
    REQ_TEACH_ACCELERATOR2_START       = 0x27
    REQ_TEACH_ACCELERATOR2_MIN         = 0x28     
    REQ_TEACH_ACCELERATOR2_MAX         = 0x29 
    
    REQ_TEACH_LIFT_POTENTIOMETER_START = 0x2A
    REQ_TEACH_LIFT_POTENTIOMETER_MIN   = 0x2B     
    REQ_TEACH_LIFT_POTENTIOMETER_MAX   = 0x2C   
   
    
class id_option:
    HardwareID                          = ( 0x80, STR)
    SoftwareID_BMS_Master_Application   = ( 0x81, STR)
    SoftwareVersion                     = ( 0x84, U16L)
    SoftwareID_Bootblock                = ( 0x86, STR)
    DiagVersion                         = ( 0x87, U16L)
    HardwareSerialNumber                = ( 0x88, STR)
    LastPartNumber                      = ( 0x89, STR)
    SoftwareModule                      = ( 0x8A, U8 )
    
ecu_ID_optionMAP =collections.OrderedDict(
{
id_option.HardwareID                        : ("HardwareID",STR),
id_option.SoftwareID_BMS_Master_Application : ("SoftwareID_BMS_Master_Application",STR),
id_option.SoftwareVersion                   : ("SoftwareVersion",U16L),
id_option.SoftwareID_Bootblock              : ("SoftwareID_Bootblock",STR),
id_option.DiagVersion                       : ("DiagVersion",U16L),
id_option.HardwareSerialNumber              : ("HardwareSerialNumber",STR),
id_option.LastPartNumber                    : ("LastPartNumber",STR),
id_option.SoftwareModule                    : ("SoftwareModule",U8 )
}
)
class diagnostic_option:
    DefaultSession      = 0x81
    ProgrammingSession  = 0x85
    
class local_id_option:
    FIRST_LID                                    = 0    
    LID_LINDE_PARTNUMBER                         = 0    
    LID_TRUCKSERIALNUMBEREOL                     = 1    
    LID_COMPONENTWORKTIME                        = 2    
    LID_BRANDID                                  = 3    
    LID_SERIAL_NUMBER                            = 32    
    LID_SW_ID_LAST_START                         = 33

    LID_TOTAL_HISTORYDTC_TYPE0                   = 58    
    LID_PUSH_HISTORYDTCINDEX_TYPE0               = 59    
    LID_POP_HISTORYDTCINDEX_TYPE0                = 60    
    LID_TOTAL_HISTORYDTC_TYPE1                   = 61    
    LID_PUSH_HISTORYDTCINDEX_TYPE1               = 62    
    LID_POP_HISTORYDTCINDEX_TYPE1                = 63    
    LID_TOTAL_HISTORYDTC_TYPE2                   = 64    
    LID_PUSH_HISTORYDTCINDEX_TYPE2               = 65    
    LID_POP_HISTORYDTCINDEX_TYPE2                = 66 
    
    LID_FAN1_TEMPERATURE_ON                      = 100    
    LID_FAN1_TEMPERATURE_OFF                     = 101   
    LID_FAN2_TEMPERATURE_ON                      = 102   
    LID_FAN2_TEMPERATURE_OFF                     = 103   
    LID_SLEEP_THERMAL_DELAY_TIME_MAX             = 104   
    LID_BUZZER_ON_IF_REVERSE                     = 105
    LID_SPEED_MAX_FWD                            = 106   
    LID_SPEED_MAX_BWD                            = 107
    LID_TRUCK_HAS_DUAL_PEDAL                     = 108
    LID_SEAT_SWITCH_DUAL_CHANNEL                 = 109   
    LID_PUMP_STEER_RPM                           = 110   
    LID_PUMP_LIFT_RPM                            = 111   
    LID_PUMP_TILT_RPM                            = 112   
    LID_PUMP_AUX1_RPM                            = 113   
    LID_PUMP_AUX2_RPM                            = 114   
    LID_PUMP_MAX_RPM                             = 115  
    LID_PERFORMANCE_MODE                         = 116
    LID_TRACTION_TORQUE_MAX                      = 117   
    LID_TRACTION_ACCELERATION_MAX                = 118   
    LID_WHEEL_DIAMETER                           = 119   
    LID_TRACTION_TORQUE_TEMP_X_1                 = 120   
    LID_TRACTION_TORQUE_TEMP_X_2                 = 121   
    LID_TRACTION_TORQUE_TEMP_X_3                 = 122   
    LID_TRACTION_TORQUE_TEMP_X_4                 = 123   
    LID_TRACTION_TORQUE_TEMP_X_5                 = 124   
    LID_TRACTION_TORQUE_TEMP_X_6                 = 125   
    LID_TRACTION_TORQUE_TEMP_X_7                 = 126   
    LID_TRACTION_TORQUE_TEMP_X_8                 = 127   
    LID_TRACTION_TORQUE_TEMP_X_9                 = 128   
    LID_TRACTION_TORQUE_TEMP_X_10                = 129   
    LID_TRACTION_TORQUE_TEMP_Y_1                 = 130   
    LID_TRACTION_TORQUE_TEMP_Y_2                 = 131   
    LID_TRACTION_TORQUE_TEMP_Y_3                 = 132   
    LID_TRACTION_TORQUE_TEMP_Y_4                 = 133    
    LID_TRACTION_TORQUE_TEMP_Y_5                 = 134    
    LID_TRACTION_TORQUE_TEMP_Y_6                 = 135    
    LID_TRACTION_TORQUE_TEMP_Y_7                 = 136    
    LID_TRACTION_TORQUE_TEMP_Y_8                 = 137    
    LID_TRACTION_TORQUE_TEMP_Y_9                 = 138    
    LID_TRACTION_TORQUE_TEMP_Y_10                = 139    
    LID_SPEED_CURVE_X_1                          = 140    
    LID_SPEED_CURVE_X_2                          = 141    
    LID_SPEED_CURVE_X_3                          = 142    
    LID_SPEED_CURVE_X_4                          = 143    
    LID_SPEED_CURVE_X_5                          = 144    
    LID_SPEED_CURVE_X_6                          = 145    
    LID_SPEED_CURVE_X_7                          = 146    
    LID_SPEED_CURVE_X_8                          = 147    
    LID_SPEED_CURVE_X_9                          = 148    
    LID_SPEED_CURVE_X_10                         = 149    
    LID_SPEED_CURVE_Y_1                          = 150    
    LID_SPEED_CURVE_Y_2                          = 151    
    LID_SPEED_CURVE_Y_3                          = 152    
    LID_SPEED_CURVE_Y_4                          = 153    
    LID_SPEED_CURVE_Y_5                          = 154    
    LID_SPEED_CURVE_Y_6                          = 155    
    LID_SPEED_CURVE_Y_7                          = 156    
    LID_SPEED_CURVE_Y_8                          = 157    
    LID_SPEED_CURVE_Y_9                          = 158    
    LID_SPEED_CURVE_Y_10                         = 159    
    LID_ACCELERATOR_CALIBRATION_CURVE_X_1        = 160    
    LID_ACCELERATOR_CALIBRATION_CURVE_X_2        = 161    
    LID_ACCELERATOR_CALIBRATION_CURVE_X_3        = 162    
    LID_ACCELERATOR_CALIBRATION_CURVE_X_4        = 163    
    LID_ACCELERATOR_CALIBRATION_CURVE_X_5        = 164    
    LID_ACCELERATOR_CALIBRATION_CURVE_X_6        = 165    
    LID_ACCELERATOR_CALIBRATION_CURVE_X_7        = 166    
    LID_ACCELERATOR_CALIBRATION_CURVE_X_8        = 167    
    LID_ACCELERATOR_CALIBRATION_CURVE_X_9        = 168    
    LID_ACCELERATOR_CALIBRATION_CURVE_X_10       = 169    
    LID_ACCELERATOR_CALIBRATION_CURVE_Y_1        = 170    
    LID_ACCELERATOR_CALIBRATION_CURVE_Y_2        = 171    
    LID_ACCELERATOR_CALIBRATION_CURVE_Y_3        = 172    
    LID_ACCELERATOR_CALIBRATION_CURVE_Y_4        = 173    
    LID_ACCELERATOR_CALIBRATION_CURVE_Y_5        = 174    
    LID_ACCELERATOR_CALIBRATION_CURVE_Y_6        = 175    
    LID_ACCELERATOR_CALIBRATION_CURVE_Y_7        = 176    
    LID_ACCELERATOR_CALIBRATION_CURVE_Y_8        = 177    
    LID_ACCELERATOR_CALIBRATION_CURVE_Y_9        = 178    
    LID_ACCELERATOR_CALIBRATION_CURVE_Y_10       = 179
    LID_OPTION_PEDAL                             = 180
    LID_OPTION_STEERANGLESENSOR                  = 181
    
    LID_TRUCK_SPEED_THRESHOLD           = 182
    LID_PUMP_STEER_CLOSE_DELAY          = 183
    LID_PUMP_STEER_RAMP_UP              = 184
    LID_PUMP_STEER_RAMP_DOWN            = 185
    LID_LIFT_MODE                       = 186
    LID_LIFT_1S_RPM                     = 187
    LID_LIFT_2S_RPM_1                   = 188
    LID_LIFT_2S_RPM_2                   = 189
    LID_LIFT_POT_MIN_RPM                = 190
    LID_LIFT_POT_MAX_RPM                = 191
    LID_PUMP_LIFT_RAMP_UP               = 192
    LID_PUMP_LIFT_RAMP_DOWN             = 193
    LID_PUMP_TILT_RAMP_UP               = 194
    LID_PUMP_TILT_RAMP_DOWN             = 195
    LID_PUMP_AUX1_RAMP_UP               = 196
    LID_PUMP_AUX1_RAMP_DOWN             = 197
    LID_PUMP_AUX2_RAMP_UP               = 198
    LID_PUMP_AUX2_RAMP_DOWN             = 199
    LID_BATT_CUTBACK_START              = 200
    LID_BATT_CUTBACK_END                = 201
    LID_BATT_RPM_CUTBACK                = 202
    LID_PUMP_MOTOR_DISCHARGE_ENABLE     = 203
    LID_REGENERATION_CURRENT_THRESHOLD  = 204
    LID_BATT_DISCHARGE_THRESHOLD        = 205
    
    LID_OPTION_LIFT                     = 206
    LID_OPTION_TRAC                     = 207
    
    LID_BATTERYTYPE                     = 209
    LID_BDI_CUTVPC                      = 217
    
    
    LAST_LID                                     = 255
    # TOTAL_LID                                    = 125  #105+20

class CommonIdOption:
    #CID_1ST         = 
    FIRST_CID       = 256    
    CID_TRUCKID     = 0x1000
    
    #calibration
    CID_KEY_SWITCH_CAL          = 1000
    CID_ACCELERATOR_1_MIN       = 1001
    CID_ACCELERATOR_1_MAX       = 1002
    CID_ACCELERATOR_2_MIN       = 1003
    CID_ACCELERATOR_2_MAX       = 1004
    CID_LIFT_POTENTIOMETER_MIN  = 1005
    CID_LIFT_POTENTIOMETER_MAX  = 1006
    CID_STEER_LEFT              = 1007
    CID_STEER_RIGHT             = 1008
    CID_STEER_NEUTRAL           = 1009
    
    CID_BDI_VBATT_CAL           = 1010
    
    #production
    CID_ENCODE_STEP          = 2000
    CID_SWAP_ENCODER         = 2001
    CID_VIN                  = 2002
    
    MON_CID_SWITCHES_CURRENT       = 3000   
    MON_CID_TEMPMOTINV1            = 3001   
    MON_CID_TEMPMOTINV2            = 3002   
    MON_CID_EXT5VSUPPLY            = 3003   
    MON_CID_EXT13VSUPPLY           = 3004   
    MON_CID_DCLINKVOLTS            = 3005   
    MON_CID_ACCELERATOR1           = 3006   
    MON_CID_ACCELERATOR2           = 3007   
    MON_CID_STEERANGA              = 3008   
    MON_CID_STEERANGB              = 3009   
    MON_CID_RESERVER1VOLTS         = 3010   
    MON_CID_RESERVER2VOLTS         = 3011   
    MON_CID_CUTOFFISOCURRENT       = 3012   
    MON_CID_MAINCNTCURRENT         = 3013   
    MON_CID_KEYSWITCH              = 3014   
    MON_CID_ENCODERSPEED           = 3015   
    MON_CID_SWITCHES_OUTPUTS       = 3016   
    MON_CID_MAINCNTPWM             = 3017   
    MON_CID_ISOCUFOFFPWM           = 3018   
    MON_CID_EXT12VSUPPLY           = 3019   
    
    
    MON_FORWARDSWITCH               =   3020
    MON_NEUTRALSWITCH               =   3021
    MON_REVERSESEITCH               =   3022
    MON_LIFT_SWITCH_1               =   3023
    MON_TILT_SWITCH                 =   3024
    MON_HYD_AUX_SWITCH_1            =   3025
    MON_LIFT_SWITCH_2               =   3026
    MON_SEAT_SWITCH_1               =   3027
    MON_SEAT_SWITCH_2               =   3028
    MON_RESERVE_INPUT               =   3029
    MON_MAIN_CONTACTOR_ERROR        =   3030
    MON_ISO_VALVE_ERROR             =   3031
    MON_BUZZER_ERROR                =   3032
    MON_FAN_ERROR                   =   3033
    MON_BOOT_ANCHOR_CPU_M           =   3034
    MON_PARK_BREAK_SWITCH           =   3035
    MON_FAN_MOTOR                   =   3036
    MON_FAN_CONTROLLER              =   3037
    MON_BUZZER                      =   3038
    MON_ALARM_BUZZER                =   3039
    MON_LED                         =   3040
    MON_PRECHARGE                   =   3041
    MON_DCDC_CONTROL                =   3042
    MON_MAIN_CONTACTOR_PWM          =   3043
    MON_ISO_VALVE_PWM               =   3044
    MON_PUMP_MOTOR_RPM              =   3045

    
    LAST_CID        = 0xFFFF    
    # TOTAL_CID       = 181    
    
stringMap = {
local_id_option.LID_LINDE_PARTNUMBER                         :("local_id_option.LID_LINDE_PARTNUMBER                   ",STR),    
local_id_option.LID_TRUCKSERIALNUMBEREOL                     :("local_id_option.LID_TRUCKSERIALNUMBEREOL               ",STR),    
local_id_option.LID_COMPONENTWORKTIME                        :("local_id_option.LID_COMPONENTWORKTIME                  ",U32L),    
local_id_option.LID_BRANDID                                  :("local_id_option.LID_BRANDID                            ",U16L),    
local_id_option.LID_SW_ID_LAST_START                         :("local_id_option.LID_SW_ID_LAST_START                   ",U32L),     
local_id_option.LID_SERIAL_NUMBER                            :("local_id_option.LID_SERIAL_NUMBER                      ",U32L),     
local_id_option.LID_TOTAL_HISTORYDTC_TYPE0                   :("local_id_option.LID_TOTAL_HISTORYDTC_TYPE0             ",U8),     
local_id_option.LID_PUSH_HISTORYDTCINDEX_TYPE0               :("local_id_option.LID_PUSH_HISTORYDTCINDEX_TYPE0         ",U8),     
local_id_option.LID_POP_HISTORYDTCINDEX_TYPE0                :("local_id_option.LID_POP_HISTORYDTCINDEX_TYPE0          ",U8),     
local_id_option.LID_TOTAL_HISTORYDTC_TYPE1                   :("local_id_option.LID_TOTAL_HISTORYDTC_TYPE1             ",U8),     
local_id_option.LID_PUSH_HISTORYDTCINDEX_TYPE1               :("local_id_option.LID_PUSH_HISTORYDTCINDEX_TYPE1         ",U8),     
local_id_option.LID_POP_HISTORYDTCINDEX_TYPE1                :("local_id_option.LID_POP_HISTORYDTCINDEX_TYPE1          ",U8),     
local_id_option.LID_TOTAL_HISTORYDTC_TYPE2                   :("local_id_option.LID_TOTAL_HISTORYDTC_TYPE2             ",U8),     
local_id_option.LID_PUSH_HISTORYDTCINDEX_TYPE2               :("local_id_option.LID_PUSH_HISTORYDTCINDEX_TYPE2         ",U8),     
local_id_option.LID_POP_HISTORYDTCINDEX_TYPE2                :("local_id_option.LID_POP_HISTORYDTCINDEX_TYPE2          ",U8),     
local_id_option.LID_FAN1_TEMPERATURE_ON                      :("local_id_option.LID_FAN1_TEMPERATURE_ON                ",S16L),     
local_id_option.LID_FAN1_TEMPERATURE_OFF                     :("local_id_option.LID_FAN1_TEMPERATURE_OFF               ",S16L),     
local_id_option.LID_FAN2_TEMPERATURE_ON                      :("local_id_option.LID_FAN2_TEMPERATURE_ON                ",S16L),     
local_id_option.LID_FAN2_TEMPERATURE_OFF                     :("local_id_option.LID_FAN2_TEMPERATURE_OFF               ",S16L),     
local_id_option.LID_SLEEP_THERMAL_DELAY_TIME_MAX             :("local_id_option.LID_SLEEP_THERMAL_DELAY_TIME_MAX       ",U16L),     
local_id_option.LID_TRUCK_HAS_DUAL_PEDAL                     :("local_id_option.LID_TRUCK_HAS_DUAL_PEDAL               ",U8),     
local_id_option.LID_BUZZER_ON_IF_REVERSE                     :("local_id_option.LID_BUZZER_ON_IF_REVERSE               ",U8),     
local_id_option.LID_SEAT_SWITCH_DUAL_CHANNEL                 :("local_id_option.LID_SEAT_SWITCH_DUAL_CHANNEL           ",U8),     
local_id_option.LID_PERFORMANCE_MODE                         :("local_id_option.LID_PERFORMANCE_MODE                   ",U8),     
local_id_option.LID_SPEED_MAX_FWD                            :("local_id_option.LID_SPEED_MAX_FWD                      ",S16L),     
local_id_option.LID_SPEED_MAX_BWD                            :("local_id_option.LID_SPEED_MAX_BWD                      ",S16L),     
local_id_option.LID_PUMP_STEER_RPM                           :("local_id_option.LID_PUMP_STEER_RPM                     ",S16L),     
local_id_option.LID_PUMP_LIFT_RPM                            :("local_id_option.LID_PUMP_LIFT_RPM                      ",S16L),     
local_id_option.LID_PUMP_TILT_RPM                            :("local_id_option.LID_PUMP_TILT_RPM                      ",S16L),     
local_id_option.LID_PUMP_AUX1_RPM                            :("local_id_option.LID_PUMP_AUX1_RPM                      ",S16L),     
local_id_option.LID_PUMP_AUX2_RPM                            :("local_id_option.LID_PUMP_AUX2_RPM                      ",S16L),     
local_id_option.LID_PUMP_MAX_RPM                             :("local_id_option.LID_PUMP_MAX_RPM                       ",S16L),     
local_id_option.LID_TRACTION_TORQUE_MAX                      :("local_id_option.LID_TRACTION_TORQUE_MAX                ",S16L),     
local_id_option.LID_TRACTION_ACCELERATION_MAX                :("local_id_option.LID_TRACTION_ACCELERATION_MAX          ",S16L),     
local_id_option.LID_WHEEL_DIAMETER                           :("local_id_option.LID_WHEEL_DIAMETER                     ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_X_1                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_X_1           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_X_2                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_X_2           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_X_3                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_X_3           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_X_4                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_X_4           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_X_5                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_X_5           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_X_6                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_X_6           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_X_7                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_X_7           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_X_8                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_X_8           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_X_9                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_X_9           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_X_10                :("local_id_option.LID_TRACTION_TORQUE_TEMP_X_10          ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_Y_1                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_Y_1           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_Y_2                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_Y_2           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_Y_3                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_Y_3           ",S16L),     
local_id_option.LID_TRACTION_TORQUE_TEMP_Y_4                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_Y_4           ",S16L),      
local_id_option.LID_TRACTION_TORQUE_TEMP_Y_5                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_Y_5           ",S16L),      
local_id_option.LID_TRACTION_TORQUE_TEMP_Y_6                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_Y_6           ",S16L),      
local_id_option.LID_TRACTION_TORQUE_TEMP_Y_7                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_Y_7           ",S16L),      
local_id_option.LID_TRACTION_TORQUE_TEMP_Y_8                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_Y_8           ",S16L),      
local_id_option.LID_TRACTION_TORQUE_TEMP_Y_9                 :("local_id_option.LID_TRACTION_TORQUE_TEMP_Y_9           ",S16L),      
local_id_option.LID_TRACTION_TORQUE_TEMP_Y_10                :("local_id_option.LID_TRACTION_TORQUE_TEMP_Y_10          ",S16L),      
local_id_option.LID_SPEED_CURVE_X_1                          :("local_id_option.LID_SPEED_CURVE_X_1                    ",S16L),      
local_id_option.LID_SPEED_CURVE_X_2                          :("local_id_option.LID_SPEED_CURVE_X_2                    ",S16L),      
local_id_option.LID_SPEED_CURVE_X_3                          :("local_id_option.LID_SPEED_CURVE_X_3                    ",S16L),      
local_id_option.LID_SPEED_CURVE_X_4                          :("local_id_option.LID_SPEED_CURVE_X_4                    ",S16L),      
local_id_option.LID_SPEED_CURVE_X_5                          :("local_id_option.LID_SPEED_CURVE_X_5                    ",S16L),      
local_id_option.LID_SPEED_CURVE_X_6                          :("local_id_option.LID_SPEED_CURVE_X_6                    ",S16L),      
local_id_option.LID_SPEED_CURVE_X_7                          :("local_id_option.LID_SPEED_CURVE_X_7                    ",S16L),      
local_id_option.LID_SPEED_CURVE_X_8                          :("local_id_option.LID_SPEED_CURVE_X_8                    ",S16L),      
local_id_option.LID_SPEED_CURVE_X_9                          :("local_id_option.LID_SPEED_CURVE_X_9                    ",S16L),      
local_id_option.LID_SPEED_CURVE_X_10                         :("local_id_option.LID_SPEED_CURVE_X_10                   ",S16L),      
local_id_option.LID_SPEED_CURVE_Y_1                          :("local_id_option.LID_SPEED_CURVE_Y_1                    ",S16L),      
local_id_option.LID_SPEED_CURVE_Y_2                          :("local_id_option.LID_SPEED_CURVE_Y_2                    ",S16L),      
local_id_option.LID_SPEED_CURVE_Y_3                          :("local_id_option.LID_SPEED_CURVE_Y_3                    ",S16L),      
local_id_option.LID_SPEED_CURVE_Y_4                          :("local_id_option.LID_SPEED_CURVE_Y_4                    ",S16L),      
local_id_option.LID_SPEED_CURVE_Y_5                          :("local_id_option.LID_SPEED_CURVE_Y_5                    ",S16L),      
local_id_option.LID_SPEED_CURVE_Y_6                          :("local_id_option.LID_SPEED_CURVE_Y_6                    ",S16L),      
local_id_option.LID_SPEED_CURVE_Y_7                          :("local_id_option.LID_SPEED_CURVE_Y_7                    ",S16L),      
local_id_option.LID_SPEED_CURVE_Y_8                          :("local_id_option.LID_SPEED_CURVE_Y_8                    ",S16L),      
local_id_option.LID_SPEED_CURVE_Y_9                          :("local_id_option.LID_SPEED_CURVE_Y_9                    ",S16L),      
local_id_option.LID_SPEED_CURVE_Y_10                         :("local_id_option.LID_SPEED_CURVE_Y_10                   ",S16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_1        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_1  ",U16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_2        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_2  ",U16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_3        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_3  ",U16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_4        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_4  ",U16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_5        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_5  ",U16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_6        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_6  ",U16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_7        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_7  ",U16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_8        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_8  ",U16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_9        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_9  ",U16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_10       :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_X_10 ",U16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_1        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_1  ",S16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_2        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_2  ",S16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_3        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_3  ",S16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_4        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_4  ",S16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_5        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_5  ",S16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_6        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_6  ",S16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_7        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_7  ",S16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_8        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_8  ",S16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_9        :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_9  ",S16L),      
local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_10       :("local_id_option.LID_ACCELERATOR_CALIBRATION_CURVE_Y_10 ",S16L),        
local_id_option.LID_OPTION_PEDAL                             :("local_id_option.LID_OPTION_PEDAL ",U8),  
local_id_option.LID_OPTION_STEERANGLESENSOR                  :("local_id_option.LID_OPTION_STEERANGLESENSOR ",U8), 

local_id_option.LID_TRUCK_SPEED_THRESHOLD                   :("local_id_option.LID_TRUCK_SPEED_THRESHOLD ",S16L), 
local_id_option.LID_PUMP_STEER_CLOSE_DELAY                  :("local_id_option.LID_PUMP_STEER_CLOSE_DELAY ",S16L), 
local_id_option.LID_PUMP_STEER_RAMP_UP                      :("local_id_option.LID_PUMP_STEER_RAMP_UP ",S16L), 
local_id_option.LID_PUMP_STEER_RAMP_DOWN                    :("local_id_option.LID_PUMP_STEER_RAMP_DOWN ",S16L), 
local_id_option.LID_LIFT_MODE                               :("local_id_option.LID_LIFT_MODE ",U8), 
local_id_option.LID_LIFT_1S_RPM                             :("local_id_option.LID_LIFT_1S_RPM ",S16L), 
local_id_option.LID_LIFT_2S_RPM_1                           :("local_id_option.LID_LIFT_2S_RPM_1 ",S16L), 
local_id_option.LID_LIFT_2S_RPM_2                           :("local_id_option.LID_LIFT_2S_RPM_2 ",S16L), 
local_id_option.LID_LIFT_POT_MIN_RPM                        :("local_id_option.LID_LIFT_POT_MIN_RPM ",S16L), 
local_id_option.LID_LIFT_POT_MAX_RPM                        :("local_id_option.LID_LIFT_POT_MAX_RPM ",S16L), 
local_id_option.LID_PUMP_LIFT_RAMP_UP                       :("local_id_option.LID_PUMP_LIFT_RAMP_UP ",S16L), 
local_id_option.LID_PUMP_LIFT_RAMP_DOWN                     :("local_id_option.LID_PUMP_LIFT_RAMP_DOWN ",S16L), 
local_id_option.LID_PUMP_TILT_RAMP_UP                       :("local_id_option.LID_PUMP_TILT_RAMP_UP ",S16L), 
local_id_option.LID_PUMP_TILT_RAMP_DOWN                     :("local_id_option.LID_PUMP_TILT_RAMP_DOWN ",S16L), 
local_id_option.LID_PUMP_AUX1_RAMP_UP                       :("local_id_option.LID_PUMP_AUX1_RAMP_UP ",S16L), 
local_id_option.LID_PUMP_AUX1_RAMP_DOWN                     :("local_id_option.LID_PUMP_AUX1_RAMP_DOWN ",S16L), 
local_id_option.LID_PUMP_AUX2_RAMP_UP                       :("local_id_option.LID_PUMP_AUX2_RAMP_UP ",S16L), 
local_id_option.LID_PUMP_AUX2_RAMP_DOWN                     :("local_id_option.LID_PUMP_AUX2_RAMP_DOWN ",S16L), 
local_id_option.LID_BATT_CUTBACK_START                      :("local_id_option.LID_BATT_CUTBACK_START ",S16L), 
local_id_option.LID_BATT_CUTBACK_END                        :("local_id_option.LID_BATT_CUTBACK_END ",S16L), 
local_id_option.LID_BATT_RPM_CUTBACK                        :("local_id_option.LID_BATT_RPM_CUTBACK ",S16L), 
local_id_option.LID_PUMP_MOTOR_DISCHARGE_ENABLE             :("local_id_option.LID_PUMP_MOTOR_DISCHARGE_ENABLE ",U8), 
local_id_option.LID_REGENERATION_CURRENT_THRESHOLD          :("local_id_option.LID_REGENERATION_CURRENT_THRESHOLD ",S16L), 
local_id_option.LID_BATT_DISCHARGE_THRESHOLD                :("local_id_option.LID_BATT_DISCHARGE_THRESHOLD ",S16L), 
local_id_option.LID_OPTION_LIFT                             :("local_id_option.LID_OPTION_LIFT ",U8), 
local_id_option.LID_OPTION_TRAC                             :("local_id_option.LID_OPTION_TRAC ",U8), 
local_id_option.LID_BATTERYTYPE                             :("local_id_option.LID_BATTERYTYPE ",U8), 
local_id_option.LID_BDI_CUTVPC                             :("local_id_option.LID_BDI_CUTVPC ",S16L), 



local_id_option.LAST_LID                                     :("local_id_option.LAST_LID ",S16L),        

#moment variables

CommonIdOption.FIRST_CID                      :("CommonIdOption.FIRST_CID ",U32L), 
# CommonIdOption.CID_TRUCKID                    :("CommonIdOption.CID_TRUCKID  ",U32L), 
#calibration
CommonIdOption.CID_KEY_SWITCH_CAL           :("CommonIdOption.CID_KEY_SWITCH_CAL ",S8), 
CommonIdOption.CID_ACCELERATOR_1_MIN        :("CommonIdOption.CID_ACCELERATOR_1_MIN ",U16L), 
CommonIdOption.CID_ACCELERATOR_1_MAX        :("CommonIdOption.CID_ACCELERATOR_1_MAX ",U16L), 
CommonIdOption.CID_ACCELERATOR_2_MIN        :("CommonIdOption.CID_ACCELERATOR_2_MIN ",U16L), 
CommonIdOption.CID_ACCELERATOR_2_MAX        :("CommonIdOption.CID_ACCELERATOR_2_MAX ",U16L), 
CommonIdOption.CID_LIFT_POTENTIOMETER_MIN   :("CommonIdOption.CID_LIFT_POTENTIOMETER_MIN ",U16L), 
CommonIdOption.CID_LIFT_POTENTIOMETER_MAX   :("CommonIdOption.CID_LIFT_POTENTIOMETER_MAX ",U16L), 
CommonIdOption.CID_STEER_LEFT               :("CommonIdOption.CID_STEER_LEFT ",U16L), 
CommonIdOption.CID_STEER_RIGHT              :("CommonIdOption.CID_STEER_RIGHT ",U16L), 
CommonIdOption.CID_STEER_NEUTRAL            :("CommonIdOption.CID_STEER_NEUTRAL ",U16L), 
CommonIdOption.CID_BDI_VBATT_CAL            :("CommonIdOption.CID_BDI_VBATT_CAL ",U16L), 

# #production
CommonIdOption.CID_ENCODE_STEP       :("CommonIdOption.CID_ENCODE_STEP ",U16L), 
CommonIdOption.CID_SWAP_ENCODER       :("CommonIdOption.CID_SWAP_ENCODER ",S8), 
CommonIdOption.CID_VIN       :("CommonIdOption.CID_VIN ",STR), 

# #moment
# CommonIdOption.MON_CID_SWITCHES_CURRENT       :("CommonIdOption.MON_LID_SWITCHES_CURRENT ",U32L), 
# CommonIdOption.MON_CID_TEMPMOTINV1            :("CommonIdOption.MON_LID_TEMPMOTINV1 ",S16L), 
# CommonIdOption.MON_CID_TEMPMOTINV2            :("CommonIdOption.MON_LID_TEMPMOTINV2 ",S16L), 
# CommonIdOption.MON_CID_EXT5VSUPPLY            :("CommonIdOption.MON_LID_EXT5VSUPPLY ",U16L), 
# CommonIdOption.MON_CID_EXT13VSUPPLY           :("CommonIdOption.MON_LID_EXT13VSUPPLY ",U16L), 
# CommonIdOption.MON_CID_DCLINKVOLTS            :("CommonIdOption.MON_LID_DCLINKVOLTS ",U16L), 
# CommonIdOption.MON_CID_ACCELERATOR1           :("CommonIdOption.MON_LID_ACCELERATOR1 ",U16L), 
# CommonIdOption.MON_CID_ACCELERATOR2           :("CommonIdOption.MON_LID_ACCELERATOR2 ",U16L), 
# CommonIdOption.MON_CID_STEERANGA              :("CommonIdOption.MON_LID_STEERANGA ",U16L), 
# CommonIdOption.MON_CID_STEERANGB              :("CommonIdOption.MON_LID_STEERANGB ",U16L), 
# CommonIdOption.MON_CID_RESERVER1VOLTS         :("CommonIdOption.MON_LID_RESERVER1VOLTS ",U16L), 
# CommonIdOption.MON_CID_RESERVER2VOLTS         :("CommonIdOption.MON_LID_RESERVER2VOLTS ",U16L), 
# CommonIdOption.MON_CID_CUTOFFISOCURRENT       :("CommonIdOption.MON_LID_CUTOFFISOCURRENT ",U16L), 
# CommonIdOption.MON_CID_MAINCNTCURRENT         :("CommonIdOption.MON_LID_MAINCNTCURRENT ",U16L), 
CommonIdOption.MON_CID_KEYSWITCH              :("CommonIdOption.MON_LID_KEYSWITCH ",U16L), 
# CommonIdOption.MON_CID_ENCODERSPEED           :("CommonIdOption.MON_LID_ENCODERSPEED ",S16L), 
# CommonIdOption.MON_CID_SWITCHES_OUTPUTS       :("CommonIdOption.MON_LID_SWITCHES_OUTPUTS ",U32L), 
# CommonIdOption.MON_CID_MAINCNTPWM             :("CommonIdOption.MON_LID_MAINCNTPWM ",U8), 
# CommonIdOption.MON_CID_ISOCUFOFFPWM           :("CommonIdOption.MON_LID_ISOCUFOFFPWM ",U8), 
# CommonIdOption.MON_CID_EXT12VSUPPLY           :("CommonIdOption.MON_LID_EXT12VSUPPLY ",U16L), 

# CommonIdOption.MON_FORWARDSWITCH       :("CommonIdOption.MON_FORWARDSWITCH ",U8), 
# CommonIdOption.MON_NEUTRALSWITCH       :("CommonIdOption.MON_NEUTRALSWITCH ",U8), 
# CommonIdOption.MON_REVERSESEITCH       :("CommonIdOption.MON_REVERSESEITCH ",U8), 
# CommonIdOption.MON_LIFT_SWITCH_1       :("CommonIdOption.MON_LIFT_SWITCH_1 ",U8), 
# CommonIdOption.MON_TILT_SWITCH       :("CommonIdOption.MON_TILT_SWITCH ",U8), 
# CommonIdOption.MON_HYD_AUX_SWITCH_1       :("CommonIdOption.MON_HYD_AUX_SWITCH_1 ",U8), 
# CommonIdOption.MON_LIFT_SWITCH_2       :("CommonIdOption.MON_LIFT_SWITCH_2 ",U8), 
# CommonIdOption.MON_SEAT_SWITCH_1       :("CommonIdOption.MON_SEAT_SWITCH_1 ",U8), 
# CommonIdOption.MON_SEAT_SWITCH_2       :("CommonIdOption.MON_SEAT_SWITCH_2 ",U8), 
# CommonIdOption.MON_RESERVE_INPUT       :("CommonIdOption.MON_RESERVE_INPUT ",U8), 
# CommonIdOption.MON_MAIN_CONTACTOR_ERROR       :("CommonIdOption.MON_MAIN_CONTACTOR_ERROR ",U8), 
# CommonIdOption.MON_ISO_VALVE_ERROR       :("CommonIdOption.MON_ISO_VALVE_ERROR ",U8), 
# CommonIdOption.MON_BUZZER_ERROR       :("CommonIdOption.MON_BUZZER_ERROR ",U8), 
# CommonIdOption.MON_FAN_ERROR       :("CommonIdOption.MON_FAN_ERROR ",U8), 
# CommonIdOption.MON_BOOT_ANCHOR_CPU_M       :("CommonIdOption.MON_BOOT_ANCHOR_CPU_M ",U8), 
# CommonIdOption.MON_PARK_BREAK_SWITCH       :("CommonIdOption.MON_PARK_BREAK_SWITCH ",U8), 
# CommonIdOption.MON_FAN_CONTROLLER       :("CommonIdOption.MON_FAN_CONTROLLER ",U8), 
# CommonIdOption.MON_BUZZER       :("CommonIdOption.MON_BUZZER ",U8), 
# CommonIdOption.MON_LED       :("CommonIdOption.MON_LED ",U8), 
# CommonIdOption.MON_DCDC_CONTROL       :("CommonIdOption.MON_DCDC_CONTROL ",U8), 
# CommonIdOption.MON_MAIN_CONTACTOR_PWM       :("CommonIdOption.MON_MAIN_CONTACTOR_PWM ",U8), 
# CommonIdOption.MON_ISO_VALVE_PWM       :("CommonIdOption.MON_ISO_VALVE_PWM ",U8), 
# CommonIdOption.MON_PUMP_MOTOR_RPM       :("CommonIdOption.MON_PUMP_MOTOR_RPM ",U8), 
}

    #----------------end of excel parameters-----------------------------#

formatMap ={
#type,[packFormat,unpackFormat]
U8:    ['B','B'],
S8:    ['b','B'],
U16L:   ['H','BB'],
S16L:   ['h','BB'],
U32L:   ['I','BBBB'],
S32L:   ['i','BBBB'],
F32:    ['f','BBBB'],
STR:    ['s','B'],
}

